/**
 * @author wangli
 * @create Wed Feb 08 07:32:19 CST 2017
 * @description
 */
package com.os.toytrade.domain.busi;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.mjoys.common.serializer.CustomDateDeserializer;
import com.mjoys.common.serializer.CustomDateSerializer;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.Range;

@JsonIgnoreProperties(ignoreUnknown = true)
@Entity
@Table(name = "mgr.lg_busi_set_condition_info")
public class SetConditionInfo implements Serializable {
    @Column(name = "id")
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Integer id;

    @Column(name = "condition_id")
    @NotNull(message = "枚举不能为空" )
    private Integer conditionId;

    @Column(name = "price")
    @NotNull(message = "求购时，用于扣减价格不能为空" )
    private Double price;

    @Column(name = "created_at")
    @NotNull(message = "aa不能为空" )
    @JsonSerialize(using = CustomDateSerializer.class)
    @JsonDeserialize(using = CustomDateDeserializer.class)
     @Temporal(TemporalType.TIMESTAMP)
    private Date createdAt;

    @Column(name = "updated_at")
    @NotNull(message = "aa不能为空" )
    @JsonSerialize(using = CustomDateSerializer.class)
    @JsonDeserialize(using = CustomDateDeserializer.class)
     @Temporal(TemporalType.TIMESTAMP)
    private Date updatedAt;

    @Column(name = "remarks")
    @NotBlank(message = "aa不能为空" )
    @Length(max=255,message = "aa必须在{min}和{max之间}")
    private String remarks;

    private static final long serialVersionUID = 1L;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getConditionId() {
        return conditionId;
    }

    public void setConditionId(Integer conditionId) {
        this.conditionId = conditionId;
    }

    public Double getPrice() {
        return price;
    }

    public void setPrice(Double price) {
        this.price = price;
    }

    public Date getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Date createdAt) {
        this.createdAt = createdAt;
    }

    public Date getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(Date updatedAt) {
        this.updatedAt = updatedAt;
    }

    public String getRemarks() {
        return remarks;
    }

    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        SetConditionInfo other = (SetConditionInfo) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getConditionId() == null ? other.getConditionId() == null : this.getConditionId().equals(other.getConditionId()))
            && (this.getPrice() == null ? other.getPrice() == null : this.getPrice().equals(other.getPrice()))
            && (this.getCreatedAt() == null ? other.getCreatedAt() == null : this.getCreatedAt().equals(other.getCreatedAt()))
            && (this.getUpdatedAt() == null ? other.getUpdatedAt() == null : this.getUpdatedAt().equals(other.getUpdatedAt()))
            && (this.getRemarks() == null ? other.getRemarks() == null : this.getRemarks().equals(other.getRemarks()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getConditionId() == null) ? 0 : getConditionId().hashCode());
        result = prime * result + ((getPrice() == null) ? 0 : getPrice().hashCode());
        result = prime * result + ((getCreatedAt() == null) ? 0 : getCreatedAt().hashCode());
        result = prime * result + ((getUpdatedAt() == null) ? 0 : getUpdatedAt().hashCode());
        result = prime * result + ((getRemarks() == null) ? 0 : getRemarks().hashCode());
        return result;
    }

    public SetConditionInfo id(Integer value) {
        this.id = value;
        return this;
    }

    public SetConditionInfo conditionId(Integer value) {
        this.conditionId = value;
        return this;
    }

    public SetConditionInfo price(Double value) {
        this.price = value;
        return this;
    }

    public SetConditionInfo createdAt(Date value) {
        this.createdAt = value;
        return this;
    }

    public SetConditionInfo updatedAt(Date value) {
        this.updatedAt = value;
        return this;
    }

    public SetConditionInfo remarks(String value) {
        this.remarks = value;
        return this;
    }
}